
<?php 
if (isset($_SESSION['cart'])) {?>
<div id="contentgiohang">
	<div class="tieudegiohang">
		<img src="public/images/title_cart.png" />
		<h2>THÔNG TIN ĐẶT HÀNG</h2>
	</div>
	<div class="noidunggiohang">
		<form name="update" action="" method="post">
			<table width="610px" cellspacing="0" cellpadding="0" border="1">
				<tr class="bg_cart_giohang" height="30px">
					<th width="5%" class="table_cart">STT</th>
					<th width="25%" class="table_cart">Tên hàng</th>
					<th width="15%" class="table_cart">Số lượng</th>
					<th width="15%" class="table_cart">Đơn giá</th>
					<th width="15%" class="table_cart">Thành tiền</th>
				</tr>
				<?php
				$i = 1;
				$sumTotal = 0;
				foreach ($_SESSION['cart'] as $key => $value) {
					?>
				<tr height="30px">
					<td class="table_cart"><?php echo $i; ?></td>
					<td class="table_cart" align="left"><?php echo $value['tenmh'];?></td>
					<td class="table_cart"><?php echo $value['soluong'];?>
					</td>
					<td class="table_cart"><?php echo $value['gia'];?></td>
					<td class="table_cart"><?php
					$total = $value['soluong'] * $value['gia'];
					echo $total;
					?>
					</td>
					
				</tr>
				<?php
				$sumTotal += $total;
				$i++;
				}
				?>
				<tr height="30px">
					<th class="table_cart" colspan="4" align="right" valign="top"
						scope="row">Tổng cộng</th>
					<th class="table_cart" align="center" valign="top"><?php echo $sumTotal; ?>VNĐ
					</th>
					
				</tr>

			</table>
			
		</form>
	</div>
	<?php
} 

if(!isset($_SESSION['username']))
{
	

?>

</div>


<form action="" method="post" name="muahang">
  <table width="600" border="0" cellspacing="2" cellpadding="2">
    <tr>
      <td colspan="2" align="center">Thông tin khách hàng</td>
    </tr>
    <tr>
      <td width="160">*Họ và tên:</td>
      <td width="430"><input name="tenkh" type="text" id="username" maxlength="100"></td>
      <span id="idht"></span></label></td>
    </tr>
    <tr>
      <td>*Địa chỉ:</td>
      <td><input name="diachi" type="text" id="username" maxlength="500"></td>
      <span id="idht"></span></label></td>
    </tr>
    <tr>
      <td>*Số điện thoại:</td>
      <td><input type="text" name="sdt" id="username"></td>
      <span id="idht"></span></label></td>
    </tr>
    <tr>
      <td>*Email:</td>
      <td><input type="text" name="email" id="username"></td>
      <span id="idht"></span></label></td>
    </tr>
       <tr>
    <td colspan="2" align="center"><input type="submit" name="mua" id="mua" value="Mua" /></td>
     
    </tr>
  
  
  
  </table>
	
</form>
</div>
<?php 
}
else 
{
	if(isset($kh)){
		?>

<form action="" method="post" name="muahang">
  <table width="600" border="0" cellspacing="2" cellpadding="2">
    <tr>
      <td colspan="2" align="center">Thông tin khách hàng</td>
    </tr>
    <tr>
      <td width="160">Họ và tên:</td>
      <td width="430"><?php echo $kh['TenKH'];?></td>
    </tr>
    <tr>
      <td>Địa chỉ:</td>
      <td><?php echo $kh['DiaChi'];?></td>
    </tr>
    <tr>
      <td>Số điện thoại:</td>
      <td><?php echo $kh['SDT'];?></td>
    </tr>
    <tr>
       <td colspan="2" align="center"><a href="index.php?mod=mua">mua</a></td>
    </tr>
  
  
  
  </table>
	
</form>
</div>
<?php
}}


?>


